import { axios } from '@/utils/request'

export function uploadCase(formData) {
  return axios({
    url: '/case/upload',
    method: 'post',
    data: formData
  })
}

export function uploadCaseExcel(caseBody) {
  return axios({
    url: '/case/import',
    method: 'post',
    data: caseBody
  })
}

export function addCase(caseInfo, caseBody, createBy) {
  return axios({
    url: '/case/add',
    method: 'post',
    data: { caseInfo: caseInfo, caseBody: caseBody, createBy: createBy }
  })
}

export function getCaseList(current, pageSize, criteria) {
  return axios({
    url: '/case/getCaseList',
    method: 'post',
    data: { current: current, size: pageSize, criteria: criteria }
  })
}

export function showCaseInfo(id) {
  return axios({
    url: '/case/showCaseInfo/' + id,
    method: 'get'
  })
}

export function editCase(data) {
  return axios({
    url: '/case/edit/',
    method: 'post',
    data: data
  })
}

export function exportCase(data) {
  return axios({
    url: '/case/download/' + data,
    method: 'get',
    responseType: 'blob'
  })
}

export function auditCase(data) {
  return axios({
    url: '/case/audit/' + data,
    method: 'get'
  })
}

export function returnCase(data) {
  return axios({
    url: '/case/return/' + data,
    method: 'get'
  })
}

export function delCase(data) {
  return axios({
    url: '/case/delete/' + data,
    method: 'get'
  })
}

export function allocateCase(developPrincipal, caseId) {
  return axios({
    url: '/case/allocateCase/',
    method: 'post',
    data: { 'develop': developPrincipal, 'caseId': caseId }
  })
}
